<?php


namespace app\order\admin;


use app\admin\controller\Admin;
use app\common\builder\ZBuilder;
use think\Db;


class Index extends Admin
{

    /**
     * @return mixed
     * @throws \think\Exception
     */
    public function index(){

        $map        = $this->getMap();
        $user_auth  = session('user_auth');
        if($user_auth['uid'] != 1){
            $number             = $user_auth['number'];
            $map['ref_number']  = $number;
        }
        $data       = Db::name('order')->where($map)->paginate();
        return ZBuilder::make('table')
            ->hideCheckbox()
            ->addColumns([

                ['ref_number','推荐人工号'],
                ['name','申请人姓名'],
                ['id_card','身份证号码'],
                ['zhima','芝麻分'],
                ['car','是否有车',['无','有']],
                ['house','是否有房',['无','有']],
                ['gongjijin','公积金',['无','有']],
                ['shebao','社保',['无','有']],
                ['create_time','创建时间','callback',function($val){return substr($val,0,16);}],

            ])
            ->setSearch(['ref_number','name'],'')
            ->setRowList($data)
            ->setPages($data->render())
            ->fetch();

    }

}